package com.yalu.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;



public class BaseUtil {
	
	/**
	* @Description: 根据时间戳返回当前时间字符串
	* @param timeStamp
	* @return
	* @date 2012-11-27下午02:35:21
	* @author zch
	*/
	public static String formatDate(long timeStamp,String formatStr){
		DateFormat format = new SimpleDateFormat(formatStr);
		String dateStr = format.format(new Date(timeStamp));
		return dateStr;
	}
	
	/**
	* @Description: 获取当前时间 yyyyMMddHHmmss
	* @return
	* @date 2013-10-21 上午10:51:56
	* @author zch
	*/
	public static String getNow(){
		return BaseUtil.formatDate(System.currentTimeMillis(),"yyyyMMddHHmmss");
	}
	/**
	* @Description: 获取当前时间 yyyy-MM-dd HH:mm:ss
	* @return
	* @date 2013-10-28 下午09:44:37
	* @author zch
	*/
	public static String getTime(){
		return BaseUtil.formatDate(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss");
	}
	
}
